// composables/useAsyncComponents.ts
import { defineAsyncComponent } from "vue";

export const useAsyncComponents = () => {
  // 模态框组件
  const RepositoryModalAsync = defineAsyncComponent({
    loader: () => import("../components/modals/RepositoryModal.vue"),
    loadingComponent: () => import("../components/ui/ModalLoader.vue"),
    delay: 200,
    timeout: 3000,
  });

  // 其他可能用到的异步组件
  const UserInfoCardAsync = defineAsyncComponent(
    () => import("../components/cards/UserInfoCard.vue")
  );

  const StatsCardAsync = defineAsyncComponent(
    () => import("../components/cards/StatsCard.vue")
  );

  return {
    RepositoryModalAsync,
    UserInfoCardAsync,
    StatsCardAsync,
  };
};
